home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
EnigmA Amiga Run 1996 March
/
EnigmA AMIGA RUN 05 (1996)(G.R. Edizioni)(IT)[!][issue 1996-03][Skylink CD IV].iso
/
earcd
/
comm2
/
parnet.lha
/
parnet
/
sources
/
defs.h
next >
Wrap
C/C++ Source or Header
|
1993-11-18
|
4KB
|
156 lines
/*
* DEFS.H
*
* ---- NOTE, ONLY IOREQUEST STRUCTURE IS PUBLIC, ALL OTHER STRUCTURES
* **WILL** CHANGE WITHOUT NOTICE ----
*/
#define PARNET_SRC
#include <exec/types.h>
#include <devices/trackdisk.h>
#include <devices/timer.h>
#include <hardware/intbits.h>
#include <exec/errors.h>
#include <exec/interrupts.h>
#include <dos/dos.h>
#include <clib/exec_protos.h>
#include <clib/alib_protos.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <pragmas/exec_pragmas.h>
#define PORTNAME "parnet.cfg"
#define MAXPKTSIZE (8192+256)
#define IOF_QUEUED 0x02
#define IOF_RUN 0x04
#define STRM_RESERVE 0x8000 /* ports reserved for stream protocol */
#define STRM_PORTS 512 /* must be factor of 32 */
typedef unsigned char ubyte;
typedef unsigned short uword;
typedef unsigned long ulong;
typedef struct Library LIB;
typedef struct MsgPort PORT;
typedef struct List LIST;
typedef struct Node NODE;
typedef struct MinNode MNODE;
typedef struct Task Task;
typedef struct Message Message;
typedef struct timerequest IOT;
typedef long (*func_ptr)();
typedef void (*func_void)();
struct Packet;
struct IOParReq;
typedef struct IOParReq Iob;
typedef struct {
LIB Lib; /* library node */
ubyte ParAddress; /* 1-255 */
PORT Port; /* task port */
long PLock[2]; /* task lock */
LIST UnitList; /* active units (ports) */
} Device;
/*
* Unit Core Structure (not user accessable) (do not access!)
*/
typedef struct {
NODE Node; /* link node DO NOT MOVE */
/* begin I/O DO NOT MOVE */
void (*BeginIO)(Iob *);
/* abort I/O DO NOT MOVE */
void (*AbortIO)(Iob *);
void (*CloseFunc)(Iob *);
/* low level packet data */
void (*DataFunc)(int, struct Packet *, long);
uword RefCnt;
uword Port; /* core port ident */
uword Protocol; /* protocol id */
ulong DestAddr; /* destination 0 = self */
uword Flags; /* status flags */
uword State; /* (protocol private) */
long UnitLock[2];
LIST PendIOR; /* pending read requests */
LIST PendIOW; /* pending write requests */
LIST PendCon; /* pending connect requests */
LIST PendLsn; /* pending listen requests */
} Unit;
/*
* Io request structure and user defines
*/
#include "devices/parnet.h"
/*
* A low level network packet
*/
typedef struct Packet {
Message Msg;
Iob *iob; /* IO req (unit_str) */
Unit *io_Unit; /* unit involved */
ubyte DestAddr; /* Destination machine */
ubyte Reserved;
uword DestPort; /* Destination port no. */
ulong DLen1; /* Data Length */
ulong DLen2; /* Data Length */
ubyte *Data1; /* Data Pointer (lw algn) */
ubyte *Data2; /* Data Pointer (lw algn) */
} Packet;
/*
* private public port to remember addr across closes.
*/
typedef struct {
PORT Port;
long Address;
long Timeout;
char DebugBuf[32];
} PubPort;
/*
* Globals
*/
extern long ParLLTimeout; /* par.asm */
extern Device *DevBase;
extern PubPort *StickyPort;
/* parnet.c */
extern Unit *FindUnitForPort(uword);
extern Unit *AllocUnit(Iob *, func_void, func_void, func_void,func_void);
void FreeUnit(Unit *);
extern Packet *AllocParPacket(Iob *, Unit *, ubyte *, long, ubyte *, long);
void FreeParPacket(Packet *);
extern void ReadConfig(void);
extern void WriteConfig(void);
/* lock.asm */
extern void LockAddr(long *);
extern void UnlockAddr(long *);
extern int TryLockAddr(long *);
/* par.asm */
extern void ParAddress(int); /* par.asm */
extern void Time10000(void); /* par.asm */
/* task.c */
extern void ParNetTask(void); /* task.c */
void QueuePacketForWrite(Packet *);
/* unit_ctl.c */
void CtlBeginIO(Iob *);